//
//  FinAuthCameraDelegate.h
//  FinAuthBaseKit
//
//  Created by FinAuthDev on 2024/5/18.
//  Copyright © 2024年 FinAuth. All rights reserved.
//

#ifndef FinAuthCameraDelegate_h
#define FinAuthCameraDelegate_h
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>

typedef enum : NSUInteger {
    FinAuthCameraErrorNOPermission        = 100,
    FinAuthCameraErrorNOSessionPreset,
    FinAuthCameraErrorNODevice,
    FinAuthCameraErrorTakeNOSessionPreset,
    FinAuthCameraErrorTakeNOPhoto,
} FinAuthCameraErrorType;

@protocol FinAuthCameraDelegate <NSObject>

@required
//  Output Video
- (void)cameraCaptureOutput:(AVCaptureOutput *)captureOutput
      didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
             fromConnection:(AVCaptureConnection *)connection;

@optional
//  Output Audio
- (void)cameraCaptureOutput:(AVCaptureOutput *)captureOutput
       didAudioSampleBuffer:(CMSampleBufferRef)sampleBuffer
             fromConnection:(AVCaptureConnection *)connection;

- (void)cameraCaptureOutput:(AVCaptureOutput *)captureOutput
      didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
             fromConnection:(AVCaptureConnection *)connection
                  cameraISO:(float)ISO
                cameraTimer:(CMTime)time
               lensAperture:(float)lensAperture;

- (void)cameraCaptureOutput:(AVCaptureOutput *)captureOutput error:(FinAuthCameraErrorType)error;

- (void)cameraCaptureFinishVideoRecord:(NSString *)videoFilePathStr;
- (void)cameraCapturePrepareCompleteVideoRecord;
- (void)cameraCaptureFailedVideoRecord;
- (void)cameraCaptureTakePhoto:(UIImage *)photoImage;

@end

#endif /* FinAuthCameraDelegate_h */
